/*
 * Copyright (c) 2023 iQi.Co.Ltd. All rights reserved.
 */
 
using IQIGame.Onigao.Framework;
using System.Collections.Generic;
using System.Linq;
using System;
using NetProtocol.Enum;

namespace NetProtocol.POD {

	/// <summary>
	/// 运营活动个人数据
	/// module : structs
	/// </summary>
	public class OperationEventDataPOD : IPOD 
    {
        public readonly static Func<OperationEventDataPOD> FACTORY = () => new OperationEventDataPOD();
		public static Func<OperationEventDataPOD> DynamicFactory = FACTORY;
        
		/*-- members --*/
		/// <summary>
        ///  活动配置Id
        /// </summary>
		public int eventCfgId;
		/// <summary>
        ///  活动subdata配置Id
        /// </summary>
		public int dataCfgId;
		/// <summary>
        /// 投票活动
        /// </summary>
		public VoteDataPOD voteDataPOD;
		
		
		
		/*-- constructors --*/
		public OperationEventDataPOD() {}
		public OperationEventDataPOD(int eventCfgId, int dataCfgId, VoteDataPOD voteDataPOD) {
			this.eventCfgId = eventCfgId;
			this.dataCfgId = dataCfgId;
			this.voteDataPOD = voteDataPOD;
		}
	      public void Serial(SOutputStream _out) {
            _out.Write_int(eventCfgId);
            _out.Write_int(dataCfgId);
            _out.Write_pod(voteDataPOD);
        }
        
        public void UnSerial(SInputStream _in) {
            if(!_in.HasRemaining()) return;
            eventCfgId = _in.Read_int();
            if(!_in.HasRemaining()) return;
            dataCfgId = _in.Read_int();
            if(!_in.HasRemaining()) return;
            voteDataPOD = _in.Read_pod<VoteDataPOD>(VoteDataPOD.DynamicFactory);
        }
		
		public OperationEventDataPOD Clone() {
            OperationEventDataPOD o = DynamicFactory();
            o.eventCfgId = eventCfgId;
            o.dataCfgId = dataCfgId;
            if (voteDataPOD != null) {
                o.voteDataPOD = voteDataPOD.Clone();
            }
            return o;
        }
        
        public void Clear() {
            eventCfgId = default;
            dataCfgId = default;
            voteDataPOD = default;
        }
		
        public override string ToString() {
			string str = "";
			str += "OperationEventDataPOD [";
			str += "eventCfgId=";
			str += eventCfgId;
			str += ", dataCfgId=";
			str += dataCfgId;
			str += ", voteDataPOD=";
			str += voteDataPOD;
			str += "]";
			return str;
		}
		
	}
}